<!-- 全屏视频 -->
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { useAppStore  }  from "@/stores"
const appStore = useAppStore()

// 关闭全屏
const exitFullscreen = () => {
  appStore.setShowVideoLayer(false)
};

onMounted(async () => {
  // 判断图片数量
  if(appStore.preVideos){
    const video = document.querySelector('.layer-full-screen-content') as HTMLVideoElement
    video.play()
  }
});


</script>


<template>
  <div class="layer-full-screen">
    <div class="layer-full-screen-mask" @click="exitFullscreen"></div>
    <video class="layer-full-screen-content" :src="appStore.preVideos"  @click="exitFullscreen"></video>
  </div>
</template>
<style scoped lang="scss">
.layer-full-screen{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  
  .layer-full-screen-mask{
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
  
  .layer-full-screen-content{
    max-width: 100%;
    max-height: 100%;
  }
  
  &:active{
    overflow: auto;
  }
}

</style>